﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YanZhiwei.DotNet2.Utilities.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YanZhiwei.DotNet2.Utilities;
using YanZhiwei.DotNet2.Utilities.Tests;
namespace YanZhiwei.DotNet2.Utilities.Common.Tests
{
    [TestClass()]
    public class CheckHelperTests
    {
        [TestMethod()]
        public void InRangeTest()
        {
            bool _actual = CheckHelper.InRange("2", 1, 5);
            Assert.IsTrue(_actual);
        }
        [TestMethod()]
        public void IsNumberTest()
        {
            bool _actual = CheckHelper.IsNumber("abc");
            Assert.IsFalse(_actual);
        }
        [TestMethod()]
        public void NotNullTest()
        {
            bool _actual = CheckHelper.NotNull("abc");
            Assert.IsTrue(_actual);
        }
        [TestMethod()]
        public void IsEmailTest()
        {
            bool _actual = CheckHelper.IsEmail("Yan.Zhiwei@hotmail.com");
            Assert.IsTrue(_actual);
        }
        [TestMethod()]
        public void IsURLTest()
        {
            bool _actual = CheckHelper.IsURL("www.cnblogs.com/yan-zhiwei");
            Assert.IsTrue(_actual);
            bool _actual_error = CheckHelper.IsURL("www.cnb");
            Assert.IsFalse(_actual_error);
        }
        [TestMethod()]
        public void IsFilePathTest()
        {
            bool _actual = CheckHelper.IsFilePath(@"C:\alipay\log.txt");
            Assert.IsTrue(_actual);
            bool _actual_error = CheckHelper.IsFilePath("alipay");
            Assert.IsFalse(_actual_error);
        }
        [TestMethod()]
        public void IsPoseCodeTest()
        {
            bool _actual = CheckHelper.IsPoseCode("412000");
            Assert.IsTrue(_actual);
            bool _actual_error = CheckHelper.IsPoseCode("alipay");
            Assert.IsFalse(_actual_error);
        }
        [TestMethod()]
        public void IsBase64Test()
        {
            bool _actual = CheckHelper.IsBase64("6KiA5b+X5Lyf");
            Assert.IsTrue(_actual);
            bool _actual_error = CheckHelper.IsBase64("yanzhiwei");
            Assert.IsFalse(_actual_error);
        }
        [TestMethod()]
        public void IsImageFormatTest()
        {
            byte[] _data = ImageHelper.ToBytes(TestResource.cat);
            bool _actual = CheckHelper.IsImageFormat(_data);
            Assert.IsTrue(_actual);
            byte[] _data_txt = TestResource.book;
            bool _actual_error = CheckHelper.IsImageFormat(_data_txt);
            Assert.IsFalse(_actual_error);
        }

        [TestMethod()]
        public void IsDateTest()
        {
            bool _actual = CheckHelper.IsDate("2014年12月12日");
            Assert.IsTrue(_actual);
        }
    }
}